//package com.amumu.drama.portal.controller;
//
//import com.amumu.drama.common.api.CommonResult;
//import com.amumu.drama.common.modules.coupon.dto.SmsCouponHistoryDetail;
//import com.amumu.drama.common.modules.member.service.UmsMemberService;
//import com.amumu.drama.common.modules.order.dto.CartPromotionItem;
//import com.amumu.drama.common.modules.order.service.OmsCartItemService;
//import com.amumu.drama.common.modules.order.service.UmsMemberCouponService;
//import com.amumu.drama.model.SmsCoupon;
//import com.amumu.drama.model.SmsCouponHistory;
//import com.amumu.drama.model.UmsMember;
//import com.amumu.drama.portal.service.AuthService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiImplicitParam;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.v3.oas.annotations.tags.Tag;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.List;
//
///**
// * 会员优惠券管理Controller
// * Created by macro on 2018/8/29.
// */
//@Controller
//@Api(tags = "UmsMemberCouponController")
//@Tag(name = "UmsMemberCouponController", description = "用户优惠券管理")
//@RequestMapping("/member/coupon")
//public class UmsMemberCouponController {
//    @Autowired
//    private UmsMemberCouponService memberCouponService;
//    @Autowired
//    private OmsCartItemService cartItemService;
//    @Autowired
//    private UmsMemberService memberService;
//    @Autowired
//    private AuthService authService;
//
//    @ApiOperation("领取指定优惠券")
//    @RequestMapping(value = "/add/{couponId}", method = RequestMethod.POST)
//    @ResponseBody
//    public CommonResult add(@PathVariable Long couponId) {
//        memberCouponService.add(couponId, authService.getCurrentMember());
//        return CommonResult.success(null, "领取成功");
//    }
//
//    @ApiOperation("获取会员优惠券历史列表")
//    @ApiImplicitParam(name = "useStatus", value = "优惠券筛选类型:0->未使用；1->已使用；2->已过期",
//            allowableValues = "0,1,2", paramType = "query", dataType = "integer")
//    @RequestMapping(value = "/listHistory", method = RequestMethod.GET)
//    @ResponseBody
//    public CommonResult<List<SmsCouponHistory>> listHistory(@RequestParam(value = "useStatus", required = false) Integer useStatus) {
//        List<SmsCouponHistory> couponHistoryList = memberCouponService.listHistory(useStatus, authService.getCurrentMember());
//        return CommonResult.success(couponHistoryList);
//    }
//
//    @ApiOperation("获取会员优惠券列表")
//    @ApiImplicitParam(name = "useStatus", value = "优惠券筛选类型:0->未使用；1->已使用；2->已过期",
//            allowableValues = "0,1,2", paramType = "query", dataType = "integer")
//    @RequestMapping(value = "/list", method = RequestMethod.GET)
//    @ResponseBody
//    public CommonResult<List<SmsCoupon>> list(@RequestParam(value = "useStatus", required = false) Integer useStatus) {
//        List<SmsCoupon> couponList = memberCouponService.list(useStatus, authService.getCurrentMember());
//        return CommonResult.success(couponList);
//    }
//
//    @ApiOperation("获取登录会员购物车的相关优惠券")
//    @ApiImplicitParam(name = "type", value = "使用可用:0->不可用；1->可用",
//            defaultValue = "1", allowableValues = "0,1", paramType = "path", dataType = "integer")
//    @RequestMapping(value = "/list/cart/{type}", method = RequestMethod.GET)
//    @ResponseBody
//    public CommonResult<List<SmsCouponHistoryDetail>> listCart(@PathVariable Integer type) {
//        UmsMember currentMember = authService.getCurrentMember();
//        List<CartPromotionItem> cartPromotionItemList = cartItemService.listPromotion(currentMember.getId(), null);
//        List<SmsCouponHistoryDetail> couponHistoryList = memberCouponService.listCart(cartPromotionItemList, type, currentMember);
//        return CommonResult.success(couponHistoryList);
//    }
//
//    @ApiOperation("获取当前商品相关优惠券")
//    @RequestMapping(value = "/listByProduct/{productId}", method = RequestMethod.GET)
//    @ResponseBody
//    public CommonResult<List<SmsCoupon>> listByProduct(@PathVariable Long productId) {
//        List<SmsCoupon> couponHistoryList = memberCouponService.listByProduct(productId);
//        return CommonResult.success(couponHistoryList);
//    }
//}
